﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace ExecutionContract
{
    public static class ExecutionContractClientSideHelper
    {
        public static void EnrichObject(Object _this, Tuple<string, object>[] _properties)
        {
            Type type = _this.GetType();
            PropertyInfo propertyInfo;
            
            foreach (Tuple<string, object> property in _properties)
            {
                propertyInfo = type.GetProperty(property.Item1);
                propertyInfo.SetValue(_this, property.Item2, null);
            }
        }
    }
}
